import { rcaNumberFormat0,get_month_first,get_month_last } from './common.js'
import { dateFormat } from '@/util/date';
import { commonTableOption } from './common.js'
// export const startDate = dateFormat(new Date(), 'yyyy-MM-') + '01';
// export const endDate = dateFormat(new Date(), 'yyyy-MM-dd');
export const startDate = get_month_first(-1);
export const endDate = get_month_last(-1);
export const tableOption = {
  ...commonTableOption,
   height: '400px',
  column: [{
    type: 'date',
    label: '日期范围',
    searchSpan: 12,
    searchRange: true,
    search: true,
    searchValue: [startDate, endDate],
    format: 'yyyy-MM-dd',                  // 这是组件展示的日期格式
    valueFormat: 'yyyy-MM-dd',
    prop: 'tradeDate',
    slot: true
  }, {
    type: 'input',
    type: 'select',
    search: true,
    label: '运营商',
    props: {
      label: 'operatorsName',
      value: 'operators'
    },
    dicUrl: '/rca/swckclearsouvenirticketreport/listoperators',
    prop: 'operators',
    formatter: (row, value, label, column) => {
      if(value=='合计'){
        return '合计'
      }else{
        return value
      }
    },
  }, {
    type: 'select',
    label: '线路',
    prop: 'lineName',
    search: false,
    display: true,
    // props: {
    //   label: 'name',
    //   value: 'code'
    // },
    // dicUrl: '/support/swparamline/dictsecondname',
    formatter: (row, value, label, column) => {
      if(value=='小计'){
        return '小计'
      }else{
        return value
      }
    },
  },
  {
    type: 'input',
    label: '售卖收入',
    prop: 'saleIncomeSouvenir',
    precision: 2,
    formatter: (row, value, label, column) => {
      return rcaNumberFormat0(value)
    },
    showSummary: true,
  }, {
    type: 'input',
    label: '清分次数',
    prop: 'clearAmountSouvenir',
    showSummary: true,
    precision: 5,
    formatter: (row, value, label, column) => {
      return rcaNumberFormat0(value)
    },
  }, {
    type: 'input',
    label: '清分比例(%)',
    prop: 'clearScaleSouvenir',
    showSummary: true,
  }, {
    type: 'input',
    label: '清分结果',
    prop: 'clearMoneySouvenir',
    showSummary: true,
    precision: 9,
    formatter: (row, value, label, column) => {
      return rcaNumberFormat0(value)
    },
  }]
}
